import CIcon from '@/components/CIcon/CIcon'
import IMenuVO from '@/model/vo/menu/IMenuVO'
import { IconHome, IconRadio } from '@douyinfe/semi-icons'
import { Space } from '@douyinfe/semi-ui'
import { ColumnProps } from '@douyinfe/semi-ui/lib/es/table'

export default [
  {
    title: '菜单名',
    dataIndex: 'name',
    render: (text: any, record: IMenuVO, index: number) => {
      return (
        <Space className="ai-c">
          {record.firstFlag && <IconHome className="cyan-5" title="起始页面" />}
          {record.icon && <CIcon icon={record.icon} />}
          {record.parentId + '' === '0' ? <strong>{text}</strong> : text}
        </Space>
      )
    },
  },
  { title: '路径', dataIndex: 'path' },
  { title: '权限', dataIndex: 'auths' },
  { title: '路由', dataIndex: 'router' },
  { title: '排序号', dataIndex: 'orderNo' },
  {
    title: '显示',
    dataIndex: 'showFlag',
    render: (text: any, record: IMenuVO, index: number) => {
      return (
        <IconRadio
          title={record.showFlag ? '显示中' : '隐藏中'}
          className={record.showFlag ? 'green' : 'red'}
        />
      )
    },
  },
  {
    title: '启用',
    dataIndex: 'enableFlag',
    render: (text: any, record: IMenuVO, index: number) => {
      return (
        <IconRadio
          title={record.enableFlag ? '启用中' : '禁用中'}
          className={record.enableFlag ? 'green' : 'red'}
        />
      )
    },
  },
] as ColumnProps<any>[]
